#ifndef WEIGHTQUERY_H
#define WEIGHTQUERY_H
#include <QObject>
#include <QString>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QDate>


    class WeightQuery: public QObject
    {
        Q_OBJECT

    private:
        QNetworkAccessManager *manager;


        QString httpQuery;
        QString jsonQuery;

    public:

        WeightQuery(QObject *parent = 0);
        WeightQuery(QString auth_token, QObject *parent = 0);
        void setQuery(QString auth_token);
        void setQueryToAdd(QString auth_token, double weight);

        ~WeightQuery();

        const QString& getHttpQuery();
        const QString& getJsonQuery();

        void doRequest();
        void doRequestToAdd();

    signals:
        void responseReceived(QString status,QDate date, double weight);
        void errorWReceived();
        void responseReceived(QString status);

    private slots:
        void onManagerFinished(QNetworkReply *reply);
        void onReplyError(QNetworkReply::NetworkError);
        void onManagerSslErrors();

        void onManagerFinishedToAdd(QNetworkReply *reply);


    private:
        WeightQuery(const WeightQuery& obj);
        WeightQuery& operator=(const WeightQuery& obj);

    }; // class WeightQuery

#endif // WEIGHTQUERY_H
